package com.lanou.sfu.songforu.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * Created by quyan on 15/10/28.
 */
public class SearchResultAdapter extends FragmentPagerAdapter {
    private List<Fragment> fragments;
    private String [] title = {"单曲","歌手","专辑","MV"};


    public SearchResultAdapter(FragmentManager fm) {
        super(fm);
    }

    public void setData(List<Fragment> dataes){
        this.fragments = dataes;
        notifyDataSetChanged();
    }

    @Override
    public Fragment getItem(int position) {
        return fragments != null && fragments.size() > 0 ? fragments.get(position) : null;
    }

    @Override
    public int getCount() {
        return title.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return title[position];
    }
}
